# 子类调用父类的属性和方法: 父类名.父类方法(self)

# 1 定义师父类 实现init函数 make_cake函数
class Master(object):
    def __init__(self):
        self.kongfu = '[传统方法]'
        pass

    def make_cake(self):
        print(f'使用{self.kongfu}摊煎饼')
        pass


# 2 定义HeimaSchool类 /init /make_cake
class HeimaSchool(object):
    def __init__(self):
        self.kongfu = '[黑马配方]'
        pass

    def make_cake(self):
        print(f'使用{self.kongfu}摊煎饼')
        pass


# 2 定义徒弟类 继承Master HeimaSchool
# class Prentice(Master, HeimaSchool):
class Prentice(HeimaSchool, Master):
    def __init__(self):
        self.kongfu = '[独创摊煎饼技术]'
        pass

    def make_cake(self):
        print(f'使用{self.kongfu}摊煎饼')
        pass

    # 通过父类名.方法名(self)来调用父类的方法
    def make_master_cake(self):
        Master.__init__(self)
        Master.make_cake(self)
        pass

    # 通过父类名.方法名(self)来调用父类的方法
    def make_school_cake(self):
        HeimaSchool.__init__(self)
        HeimaSchool.make_cake(self)
        # super(HeimaSchool, self).make_cake()
        pass


# 3 实例化徒弟类, 调用属性/调用方法
xiaoming = Prentice()  # 注: 实例化类对象,不要忘()
print(xiaoming.kongfu)
xiaoming.make_cake()

print('------------------')
xiaoming.make_school_cake()

print('------------------')
xiaoming.make_master_cake()



